﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Woodlands
{
    public class Courses
    {
        public List<CourseClass> courses;

        public Courses()
        {
            courses = new List<CourseClass>();
        }

        public void addCourse(CourseClass courseIN)
        {
            courses.Add(courseIN);
        }

        public string getName(int idIn)
        {
            foreach(CourseClass course in courses)
            {
                if (course.ID == idIn)
                {
                    return course.Name;
                }
            }
            return "No course exists with that ID";
        }
        public List<Module> getModules(int idIn)
        {
            foreach (CourseClass course in courses)
            {
                if (course.ID == idIn)
                {
                    return course.Modules;
                }
            }
            return new List<Module>();
        }

        public bool addModule(int courseIDin, Module moduleIn)
        {
            foreach (CourseClass course in courses)
            {
                if (course.ID == courseIDin)
                {
                    course.addModule(moduleIn);
                    return true;
                }
            }
            return false;
        }
    }
}
